import { useWebSiteStore } from '@/store/web/site'
import { ElMessage } from 'element-plus'

const pushPages = (list: any[] = []) => {
  const useWebSite = useWebSiteStore()
  const pages = useWebSite.getH5Pages
  let len = pages.length
  list.push({name:'无', value:0})
  for (let i = 0; i < len; i++) {
    let str = "页面-" + (i+1);
    list.push({name:str, value: (i+1)})
  }
  return list
}
const pushPops = (list: any[] = []) => {
  const useWebSite = useWebSiteStore()
  const pops = useWebSite.getPopPages
  let len = pops.length
  list.push({name:'无', value:0})
  for (let i = 0; i < len; i++) {
    let str = "弹层-" + (i+1)
    list.push({name:str, value: (i+1)})
  }
  return list
}

const showToast = (msg: string) => {
  if(msg) {
    ElMessage(msg)
  }
}

export {
  pushPages,
  pushPops,
  showToast
}